package com.epalmpay.service.activity.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.epalmpay.dto.activity.ActivityRoutineRuleOutDTO;
import com.epalmpay.entity.ActivityRoutineRule;
import com.epalmpay.mapper.ActivityRoutineRuleMapper;
import com.epalmpay.service.activity.IActivityRoutineRuleService;

/**
 * Created by Administrator on 2017/5/23.
 */
@Service("activityRoutineRuleService")
public class ActivityRoutineRuleServiceImpl implements IActivityRoutineRuleService {

    @Resource
    private ActivityRoutineRuleMapper activityRoutineRuleMapper;


    @Override
    public List<ActivityRoutineRuleOutDTO> GetRoutineActivityMemberGradeList(Long id, Long groupId) throws Exception {

        Map<String,Object> param=new HashMap<String,Object>();
        param.put("id",id);
        param.put("groupId",groupId);
        List<ActivityRoutineRuleOutDTO> newList=activityRoutineRuleMapper.selectByActivityId(param);


        return newList;
    }

    @Override
    public int UpdateRoutineActivityMemberGradeList(ActivityRoutineRule activityRoutineRule) throws Exception {

        int status=activityRoutineRuleMapper.UpdateRoutineActivityMemberGradeList(activityRoutineRule);
        return status;
    }

    @Override
    public int DeleteRoutineActivityMemberGradeList(Long activityId) throws Exception {

        int status=activityRoutineRuleMapper.deleteByActivityId(activityId);
        return status;
    }

    @Override
    public int InsetRoutineActivityMemberGrade(ActivityRoutineRule activityRoutineRule) throws Exception {

        int status=activityRoutineRuleMapper.insert(activityRoutineRule);
        return status;
    }

    @Override
    public int UpdateRoutineActivityMemberGradeListSendType(String activityId, String memberRiented) throws Exception {

        int status=activityRoutineRuleMapper.UpdateRoutineActivityMemberGradeListSendType( activityId,  memberRiented);
        return status;
    }
}
